#include <vector>
#include <unordered_map>

using namespace std;

vector<int> twoSum(vector<int> &nums, int target)
{
    unordered_map<int, int> dict;
    for (int i = 0; i < nums.size(); i++)
    {
        if (dict.find(target - nums[i]) != dict.end())
        {
            return {dict[target - nums[i]], i};
        }
        dict[nums[i]] = i;
    }
    return {-1, -1};
}

int main()
{
    vector<int> nums = {2, 7, 11, 15};
    int target = 9;

    vector<int> ans = twoSum(nums, target);
    assert(ans.size() == 2);
    assert(ans[0] == 0);
    assert(ans[1] == 1);

    return 0;
}